<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\backstage\model;
use think\Model;
use think\db;

class GoodscatModel extends Model
{
   /*类别列表*/
   public function index($cause)
   {
       $where=array();
       $data=DB::name('goods_cat')->where($where)->paginate(10);
       return $data;

   }
   /*
    * 添加类别
    * */
   public function add($data)
   {
       $array['gcid']=guid();
       $array['name']=urldecode($data['name']);
//       $array['status']=$data['status'];
       $array['ctime']=time();
       $status=Db::name('goods_cat')->insert($array);
       return $status;
   }
   /*修改类别*/
   public function detail($cause,$data)
   {
     $where=$cause;
     $status=DB::name('goods_cat')->where($where)->update($data);
     return $status;
   }
   /*删除*/
   public function del($cause)
   {
       $weher=$cause;
       $status=DB::name('goods_cat')->delete($weher);
       return $status;
   }
   /**
    * 根据id获取列表记录
   */
   public function getGcone($id){
       return DB::name('goods_cat')->where(['id'=>$id])->find();
   }

}